package homework06;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class TCPClient {
	public static void main(String[] args) throws Exception {
		Socket socket = new Socket("169.254.238.128", 8002);

		InputStreamReader reader = new InputStreamReader(socket.getInputStream());
		BufferedReader buffer_reader = new BufferedReader(reader);

		PrintWriter writer = new PrintWriter(socket.getOutputStream());

		String readline = "你现在可以向我发送消息了!";
		writer.println(readline);
		writer.flush();

		String response = buffer_reader.readLine();
		System.out.println("Server say:" + response);

		writer.close();
		buffer_reader.close();
		socket.close();
	}
}
